/**
 * @properties={typeid:35,uuid:"4370E627-A039-4A3B-A105-25284D8FCAE0",variableType:-4}
 */
var $NOMBRE_SERVIDOR = globals.$NOMBRE_SERVIDOR;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"68126DAF-4FB0-4E14-9C84-5B4338290D87"}
 */
var $NOMBRE_TABLA = "adm_t300_perfiles_menus";

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"31928539-62FD-45EC-8227-2A110F709A1D"}
 */
var $DATA_SOURCE = "db:/" + $NOMBRE_SERVIDOR + "/" + $NOMBRE_TABLA;

/**
 * Despliega el menú<br>
 * Si no se le pasa parámetro muestra sólo los menus iniciales
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSRecord<db:/pigeon_board/adm_t300_perfiles_menus>} [record_adm_t300_perfiles_menus]
 * @return {JSFoundSet<db:/pigeon_board/adm_t300_perfiles_menus>}
 *
 * @properties={typeid:24,uuid:"4B07554D-0D36-4B08-AB89-7B23878C365C"}
 * @AllowToRunInFind
 */
function mostrar_menu(record_adm_t300_perfiles_menus){
	
	// Mostramos sólo los menús asociados a su perfil
	/** @type {JSFoundSet<db:/pigeon_board/adm_t300_perfiles_menus>} */
	var fs_adm_t300_perfiles_menus = databaseManager.getFoundSet(scopes.adm_t300_perfiles_menus.$DATA_SOURCE)
	fs_adm_t300_perfiles_menus.loadAllRecords();
	
	if (record_adm_t300_perfiles_menus == null || record_adm_t300_perfiles_menus == undefined){
		if (fs_adm_t300_perfiles_menus.find()){
			fs_adm_t300_perfiles_menus.adm_t300_perfiles_menus_to_adm_t900_menus__menus.adm_t900_menus_padre_id = '^';
			fs_adm_t300_perfiles_menus.search();
		}
		return fs_adm_t300_perfiles_menus;
	}else{
		if (fs_adm_t300_perfiles_menus.find()){
			fs_adm_t300_perfiles_menus.adm_t300_perfiles_menus_to_adm_t900_menus__menus.adm_t900_menus_padre_id = '^';
			fs_adm_t300_perfiles_menus.newRecord();
			fs_adm_t300_perfiles_menus.adm_t300_perfiles_menus_to_adm_t900_menus__menus.adm_t900_menus_padre_id = record_adm_t300_perfiles_menus.adm_t300_perfiles_menus_to_adm_t900_menus__menus.adm_t900_menus_id;
			fs_adm_t300_perfiles_menus.search();
			fs_adm_t300_perfiles_menus.sort("adm_t300_perfiles_menus_to_adm_t900_menus__menus.n_orden  asc")
		}
		return fs_adm_t300_perfiles_menus;
	}
}
